package tool

import (
	"github.com/hajimehoshi/ebiten/v2/examples/resources/fonts"
	"golang.org/x/image/font"
	"golang.org/x/image/font/opentype"
	"log"
	"parkour/model"
)

type Font struct {
}

var (
	TextFont font.Face
)

func CreateFonts(config *model.Config) {
	tt, err := opentype.Parse(fonts.PressStart2P_ttf)
	if err != nil {
		log.Fatal(err)
	}
	const dpi = 72
	TextFont, err = opentype.NewFace(tt, &opentype.FaceOptions{
		Size:    float64(config.FontSize),
		DPI:     dpi,
		Hinting: font.HintingFull,
	})
	if err != nil {
		log.Fatal(err)
	}

}
